package com.base.myproject.server;

import com.base.myproject.client.jdbc.DataSet;



public class BB extends CC{


	
	 String testss = "ss";

	 public BB()
	 {
		// init();
	//	 this();
	 }
//	public BB(){
//		//super();
//	  System.out.println("Bb");
//	 
//	}
	public void info(){
	  System.out.println("info()");
	}

	protected void init()
	{
		//System.out.println("1="+testss);
		testss = "zz";
		//System.out.println("2="+testss);
	}
	int power = 0;
	int count=0;
	int gotopoint(int[][] array,int x1,int y1,int x2,int y2,int mode)
	{
		//System.out.println("count = "+ count++);
		int xtemp=x1;
		int ytemp = y1;
		
		if(x1==x2 && y1 == y2)
		{
			System.out.println("bingo");
			return 0;
		}
		//down
		if(ytemp<array[0].length-1 && mode!=3)
		{
			
				
		ytemp++;
		System.out.println("x1= "+x1+" y1="+y1+" xtemp"+ xtemp +"  ytemp ="+ytemp);
		//System.out.println("ytemp="+ytemp+"  array.length ="+array.length);
		 gotopoint(array,xtemp,ytemp,x2,y2,1);
		}
		//left
		 xtemp=x1;
		 ytemp = y1;
		 if(xtemp>0 && mode!=4)
		 {
		 xtemp--;
		 System.out.println("x1= "+x1+" y1="+y1+" xtemp"+ xtemp +"  ytemp ="+ytemp);
		 gotopoint(array,xtemp,ytemp,x2,y2,2);
		 }
		//top
		 xtemp=x1;
		 ytemp = y1;
		 if(ytemp>0 && mode!=1)
		 {
		 ytemp--;
		 System.out.println("x1= "+x1+" y1="+y1+" xtemp"+ xtemp +"  ytemp ="+ytemp);
		 gotopoint(array,xtemp,ytemp,x2,y2,3);
		 }
		//right
		 xtemp=x1;
		 ytemp = y1;
		 if(xtemp<array.length-1 && mode!=2)
		 {
		 xtemp++;
		 System.out.println("x1= "+x1+" y1="+y1+" xtemp"+ xtemp +"  ytemp ="+ytemp);
		 gotopoint(array,xtemp,ytemp,x2,y2,4);
		 }
		

		return array[x1][y1]+array[xtemp][ytemp];
//		return 0;
	}
	public static void main(String[] args) /*throws SQLException*/ {
		
		
	/*	
		int i1=14;
		int i2 =7;
		System.out.println(i1&i2);
		
		if(1==1)
		return;
		
		
		
		
		StringStack sstack = new StringStack();
		String[] strarray = new String[]{"1","1001","1002","2","2003","2005","3","3001","3002"};
		String temp=strarray[0];
		String strbf = "";
		for(int i=0;i<strarray.length;i++)
		{	
			if(temp.length()==strarray[i].length())
			{
				strbf +="</li><li>"+strarray[i];
				if(strarray[i]==strarray[strarray.length-1])
				{
					strbf+="</li>";
				}
				
				
			}
			else if(temp.length()<strarray[i].length())
			{
				strbf+="<ul><li>"+strarray[i];
				if(strarray[i]==strarray[strarray.length-1])
				{
					strbf+="</ul></li>";
				}
			}
			else if(temp.length()>strarray[i].length())
			{
				if(strarray[i]==strarray[strarray.length-1])
				{
					String temp2 =strarray[i-1];
					for(int j=i-1;j>=0;j--)
					{
						
						
						if(temp2.length()>strarray[j].length())
						{
							strbf+="</li></ul></li>";
						}
						if(strarray[j].length()==strarray[i].length())
						{
							//strbf+="</li></ul></li>";
							break;
						}
						temp2 = strarray[j];
					}
					strbf +="<li>"+strarray[i]+"</li>";
				}
				else
				{
					String temp2 =strarray[i-1];
					for(int j=i-1;j>=0;j--)
					{
						
						
						if(temp2.length()>strarray[j].length())
						{
							strbf+="</li></ul></li>";
						}
						if(strarray[j].length()==strarray[i].length())
						{
							//strbf+="</li></ul></li>";
							break;
						}
						temp2 = strarray[j];
					}
					
					strbf +="<li>"+strarray[i];
				}
			}
			temp = strarray[i];
		}
*/
		//System.out.println(strbf);
		GreetingServiceImpl dd = new GreetingServiceImpl();
		DataSet ds = dd.getDataSet("select bcode,bname from bcode");
		System.out.println(ds.getRowCount());
		
//		String[] strarr = new String[]{"a","b"};
//		String str = "a{a}{ssdfb}";
//		
//		
//		str = str.replace("{0}", "ddd");
//		
//		Pattern p = Pattern.compile("\\{\\w*\\}");
//		 Matcher m = p.matcher(str);
//		 
//	
//		
//		
//		while (m.find())
//		{
//		   int start = m.start();
//		   int end = m.end();
//		   String match = str.substring(start, end);
//		   System.out.println(match);
//		}
//		
		
//		int array[][] = {
//				{9,1,1,1,1,1,9},
//				{9,1,1,1,1,1,9},
//				{9,1,1,1,1,1,9},
//				{9,1,1,1,1,1,9},
//
//				
//				{9,1,1,1,1,1,9}
//				
//				};
//		int ox1 = 3,oy1 = 0;
//		int ox2 = 4,oy2 = 4;
//		System.out.println(array[1].length);
//		System.out.println(array.length);
//		System.out.println(array[1][0]);
//		
//		BB b = new BB();
//		b.gotopoint(array, ox1, oy1, ox2, oy2,0);
		/*BB b = new BB(1);
		  b.info();
		  System.out.println(b.testss);
		  StringBuffer sbvalue = new StringBuffer();
		  sbvalue.append("123456");
		  sbvalue = sbvalue.replace(sbvalue.length()-1, sbvalue.length(), "");
		  System.out.println(sbvalue);*/
	/*	  
		  PoolMan pm = new PoolMan();
		  CallableStatement proc = null;
		  proc =  pm.getConnection("test").prepareCall("{call ship_storelist_out(?, ?,?)}");
		  proc.setString(1	, "2000005");
		  proc.setInt(2, 10);
		 // proc.setInt(3, 10);
		  proc.registerOutParameter(3,java.sql.Types.INTEGER);  
		  proc.executeUpdate();
		  System.out.println("-------------------"+proc.getInt(3));
		  */
		/*  PoolMan pm = new PoolMan();
		  String sql = "select ccode from ccode";
		  ResultSet rs;
		try {
			rs = pm.executeQuery(sql);
			 while (rs.next())
			  {
				  String ccode = rs.getString("ccode");
				  System.out.println("ccode="+ccode);
			  }
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}*/
		 
//		  int address=proc.getInt(3);   
//		  System.out.println(address);
//		  
	}

}
